package br.edu.fucapi.pos.model.dao;

import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class JPAUtil {

	private static EntityManagerFactory emf = 
		Persistence.createEntityManagerFactory("ama");
	@Produces
	@RequestScoped //javax.enterprise.context
	public static EntityManager getEntityManager() {
		return emf.createEntityManager();
	}
	public void close(@Disposes EntityManager em) {
		em.close();
	}
}
